<template>
  <el-menu
    :style="{ width: !isCollapse ? '240px' : '64px'}"
    active-text-color="#ffd04b"
    background-color="#545c64"
    class="el-menu-vertical-demo"
    text-color="#fff"
    @open="handleOpen"
    @close="handleClose"
    :collapse="isCollapse"
    :default-active="active"
  >
    <p class="logo-lg">{{ isCollapse ? '陪诊' : '小黄人陪诊'}}</p>
    <TreeMenu :index="1" :menuData="menuData"/>
  </el-menu>
</template>
<script lang="ts" setup>
import { reactive, computed } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "Vuex";
import TreeMenu from "@/components/TreeMenu.vue"

const router = useRouter()
const store = useStore()
// const menuData = reactive(router.options.routes[0].children)
const menuData = computed(() => store.state.menu.routerList)
const isCollapse = computed (() => store.state.menu.isCollapse)
const active = computed(() => store.state.menu.menuActive)


const handleOpen = (key, keyPath) => {
  console.log(key, keyPath);
};
const handleClose = (key, keyPath) => {
  console.log(key, keyPath);
};
</script>
<style lang="scss" scoped>
.logo-lg{
    font-size: 20px;
    text-align: center;
    height: 50px;
    line-height: 50px;
    color: #fff;
}
</style>
